package com.jyu.apts.dto;

import com.jyu.apts.entity.QRCodeTemplate;
import com.jyu.apts.entityEnum.QRCodeTemplateVisibilityEnum;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class QRCodeTemplateDto {
	long id;
	String name;
	String description;
	String dataHeads;
	UserDto author;
	Integer visibility;
	String visibilityName;
	
	public QRCodeTemplateDto convert(QRCodeTemplate qrCodeTemplate) {
		setId(qrCodeTemplate.getId());
		setName(qrCodeTemplate.getName());
		setDescription(qrCodeTemplate.getDescription());
		setDataHeads(qrCodeTemplate.getDataHeads());
		setAuthor(new UserDto().convert(qrCodeTemplate.getAuthor()));
		setVisibility(qrCodeTemplate.getVisibility());
		setVisibilityName(QRCodeTemplateVisibilityEnum.values()[qrCodeTemplate.getVisibility()].getName());
		return this;
	}
	
}
